<template>
  <div v-if="icons.length" class="right-pendant">
    <template v-for="(item, index) in icons">
      <a v-if="item.jump" :key="index" :href="item.url" class="pendant__icon">
        <img
          :title="item.desc"
          :class="item.class || ''"
          :src="$withBase(`/assets/img/${item.icon}`)"
          :alt="item.desc || ''"
      /></a>
      <a v-else class="pendant__icon" href="javascript:;">
        <ImgPreview baseUrl="/assets/img/" :list="[`${item.icon}`]" />
      </a>
    </template>
  </div>
</template>

<script>
export default {
  props: {
    // 每一项必须是字符串，即assets/img文件夹下的图片名称+后缀
    icons: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {};
  },
  mounted() {
    console.log(this.icons);
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.right-pendant {
  width: 46px;
  min-height: 100px;
  position: fixed;
  right: 1%;
  bottom: 8%;
  z-index: 20210309;

  .pendant__icon {
    width: 2.2rem;
    height: 2.2rem;
    line-height: 2.2rem;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin-top: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.5s;
    background: var(--blurBg);
    img {
      margin-top: 20px;
    }
  }
  // background: red;
}
</style>
